import java.util.Scanner;

public class Test {



    /*
     * 无重复字符的最长子串
     * */

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNextLine()){
            String s = scan.nextLine();
            System.out.println(lengthOfLongestSubstring(s));
        }
    }


    public static int lengthOfLongestSubstring(String ss) {
        //首先将其转化为ASCLL码值
        char[] s = ss.toCharArray();
        int left = 0;
        int right = 0;
        int ret = 0;
        //用数组模拟哈希表
        int[] hash = new int[128];
        while(right < ss.length()){
            //进入窗口
            hash[s[right]]++;
            //当我们hash数组中有值大于1，则代表出现重复字符
            while(hash[s[right]] > 1){
                hash[s[left++]]--;//出窗口
            }
            //更新结果
            ret = Math.max(ret,right - left + 1);
            right++;
        }
        return ret;
    }

}
